<?php

namespace Common\Bundle\LibraryBundle\Entity;

use Symfony\Component\Validator\Constraints as Assert;
use Common\Bundle\LibraryBundle\Validator as LibraryAssert;
use Doctrine\ORM\Mapping as ORM;

/**
 * Qcm
 *
 * @ORM\Table("qcm")
 * @ORM\Entity(repositoryClass="Common\Bundle\LibraryBundle\Entity\Repository\QcmRepository")
 */
class Qcm
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="nom", type="string", length=255)
     * @Assert\NotBlank()
     */
    private $nom;

    /**
     * @var string
     *
     * @ORM\Column(name="description", type="text", nullable=true)
     */
    private $description;

    /**
     * @var integer
     *
     * @ORM\Column(name="ordre", type="integer", nullable=true)
     */
    private $ordre;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="dateCreation", type="date")
     */
    private $dateCreation;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="dateModifcation", type="datetime")
     */
    private $dateModifcation;

    /**
     * @var boolean
     *
     * @ORM\Column(name="actif", type="boolean")
     */
    private $actif;

    /**
     * @var Theme
     *
     * @ORM\ManyToOne(targetEntity="\Common\Bundle\LibraryBundle\Entity\Theme", inversedBy="qcms", cascade={"persist"})
     */
    private $theme;

    /**
     * @var Niveau
     *
     * @ORM\ManyToOne(targetEntity="\Common\Bundle\LibraryBundle\Entity\Niveau", cascade={"persist"})
     */
    private $niveau;

    /**
     * @var Difficulte
     *
     * @ORM\ManyToOne(targetEntity="\Common\Bundle\LibraryBundle\Entity\Difficulte", cascade={"persist"})
     */
    private $difficulte;

    /**
     * @var User
     *
     * @ORM\ManyToOne(targetEntity="\Common\Bundle\UserBundle\Entity\User", inversedBy="qcms", cascade={"persist"})
     */
    private $user;

    /**
     * @var Question
     *
     * @ORM\OneToMany(targetEntity="\Common\Bundle\LibraryBundle\Entity\Question", mappedBy="qcm", cascade={"persist", "remove"}, orphanRemoval=true)
     * @Assert\Count(min = "5", minMessage="Un qcm doit avoir un minimum de 5 questions.")
     */
    private $questions;

    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set nom
     *
     * @param string $nom
     * @return Qcm
     */
    public function setNom($nom)
    {
        $this->nom = $nom;

        return $this;
    }

    /**
     * Get nom
     *
     * @return string 
     */
    public function getNom()
    {
        return $this->nom;
    }

    /**
     * Set description
     *
     * @param string $description
     * @return Qcm
     */
    public function setDescription($description)
    {
        $this->description = $description;

        return $this;
    }

    /**
     * Get description
     *
     * @return string 
     */
    public function getDescription()
    {
        return $this->description;
    }

    /**
     * Set ordre
     *
     * @param integer $ordre
     * @return Qcm
     */
    public function setOrdre($ordre)
    {
        $this->ordre = $ordre;

        return $this;
    }

    /**
     * Get ordre
     *
     * @return integer 
     */
    public function getOrdre()
    {
        return $this->ordre;
    }

    /**
     * Set dateCreation
     *
     * @param \DateTime $dateCreation
     * @return Qcm
     */
    public function setDateCreation($dateCreation)
    {
        $this->dateCreation = $dateCreation;

        return $this;
    }

    /**
     * Get dateCreation
     *
     * @return \DateTime 
     */
    public function getDateCreation()
    {
        return $this->dateCreation;
    }

    /**
     * Set dateModifcation
     *
     * @param \DateTime $dateModifcation
     * @return Qcm
     */
    public function setDateModifcation($dateModifcation)
    {
        $this->dateModifcation = $dateModifcation;

        return $this;
    }

    /**
     * Get dateModifcation
     *
     * @return \DateTime 
     */
    public function getDateModifcation()
    {
        return $this->dateModifcation;
    }

    /**
     * @param boolean $actif
     */
    public function setActif($actif)
    {
        $this->actif = $actif;
    }

    /**
     * @return boolean
     */
    public function getActif()
    {
        return $this->actif;
    }

    /**
     * @param \Common\Bundle\LibraryBundle\Entity\Theme $theme
     */
    public function setTheme($theme)
    {
        $this->theme = $theme;
    }

    /**
     * @return \Common\Bundle\LibraryBundle\Entity\Theme
     */
    public function getTheme()
    {
        return $this->theme;
    }

    /**
     * @param \Common\Bundle\LibraryBundle\Entity\Niveau $niveau
     */
    public function setNiveau($niveau)
    {
        $this->niveau = $niveau;
    }

    /**
     * @return \Common\Bundle\LibraryBundle\Entity\Niveau
     */
    public function getNiveau()
    {
        return $this->niveau;
    }

    /**
     * @param \Common\Bundle\LibraryBundle\Entity\Difficulte $difficulte
     */
    public function setDifficulte($difficulte)
    {
        $this->difficulte = $difficulte;
    }

    /**
     * @return \Common\Bundle\LibraryBundle\Entity\Difficulte
     */
    public function getDifficulte()
    {
        return $this->difficulte;
    }

    /**
     * @param \Common\Bundle\UserBundle\Entity\User $user
     */
    public function setUser($user)
    {
        $this->user = $user;
    }
  
    /**
     * @return \Common\Bundle\UserBundle\Entity\User
     */
    public function getUser()
    {
        return $this->user;
    }

    /**
     * Add questions
     *
     * @param \Common\Bundle\LibraryBundle\Entity\Question $question
     * @return Question
     */
    public function addQuestion(\Common\Bundle\LibraryBundle\Entity\Question $questions)
    {
        $this->questions[] = $questions;

        return $this;
    }

    /**
     * Remove questions
     *
     * @param \Common\Bundle\LibraryBundle\Entity\Question $questions
     */
    public function removeQuestion(\Common\Bundle\LibraryBundle\Entity\Question $questions)
    {
        $this->questions->removeElement($questions);
    }

    /**
     * @return \Common\Bundle\UserBundle\Entity\Question
     */
    public function getQuestions()
    {
        return $this->questions;
    }

    /**
     * Constructor
     */
    public function __construct()
    {
        $this->questions = new \Doctrine\Common\Collections\ArrayCollection();
    }
}
